
<script type="text/javascript">
	
	function check()
	{
		re=/^\s*$/;
		if(re.test(formsua.tieude.value))
		{
			alert("Tiêu đề không được để trống");
			return false;
		}

	}
</script>
<!-- /TinyMCE -->
<div id="bang">

<?
	$id=$_REQUEST["id"];
	$sql="select * from pageinfo WHERE idpageinfo = $id";
	$result=mysql_query($sql) or die("Can not query pageinfo in edit.php");
	$row=mysql_fetch_array($result);
?>

<form name="formsua" method="post" action="?go=pageinfo&action=edit&id=<?=$id?>" enctype="multipart/form-data" onsubmit="return check();">
	<table border="1px"  bordercolor="#CCCCCC" cellpadding="0px" cellspacing="2px" cols="2" width="790px">
         <tr>
        	<td width="20%" align="right" style="padding-right:5px"> Mô tả </td>
            <td width="80%"><input name="description" type="text" style="width:80%" value="<? echo $row['description'];?>" /></td>
        </tr>
         <tr>
        	<td width="20%" align="right" style="padding-right:5px"> Giá trị </td>
            <td width="80%"><input name="value" type="text" style="width:80%" value="<? echo $row['value'];?>" /></td>
        </tr>
            	<tr>
        	<td width="20%" align="right" style="padding-right:5px"> Tên </td>
            <td width="80%">
            <? $select = $row['name'];
				$desc = $row['description'];
			?>
            
            	<select name="name">
                	
                	<option value="<? echo $select?>" selected="selected"><? echo $desc; ?></option>
                	<? 
					$sql2="select * from pageinfo WHERE name != '$select' ";
					$result2=mysql_query($sql2) or die("Can not query pageinfo in edit.php");
					
					while ($row2= mysql_fetch_array($result2)) 
					{ 
					?>						
                    <option value="<? echo $row2['name']?>"><? echo $row2['description'];?></option>                   
                    <? 
					} 
					?>                                                            
                </select>
            </td>
        </tr>	
        <tr>
        	<td align="right" style="padding-right:5px"> Trạng thái </td>
            <td>
            	<select name="trangthai">
                <?
					if ($row["status"]==1)
					{
				?>
                	<option value="1" selected="selected"> Hoạt Động </option>
                    <option value="0"> Không Hoạt Động </option>
                <?
					} else {
				?>
	                <option value="1"> Hoạt Động </option>
                    <option value="0" selected="selected"> Không Hoạt Động </option>
                 <?
					}
				?>
                </select>
             </td>
        </tr>
        <tr>
        	<td></td>
            <td><input type="submit" value=" Sửa "/><input type="button" onClick="location='?go=pageinfo&action=view&page=1'" value=" Quay Lại "/></td>
        </tr>
    </table>
    </form>
</div>
<div class="clear"></div>
</div>